<%--
 *  File:    UploadOrgstdprocessgoals.jsp	
 *  @Author: jackwang 
 *  Date:    2013/01/10
 *
 *  Copyright (C) 2000 - 2008 Oval Technologies, Inc.
 *  All rights reserved. 
 *
 *  This software is the confidential and proprietary information of Oval 
 *  Technologies, Inc. ("Confidential Information").  You shall not
 *  disclose such Confidential Information and shall use it only in
 *  accordance with the terms of the license agreement you entered into
 *  with Oval.
--%>

<%@ page contentType="text/html;charset=UTF-8"%>
<%@ taglib uri="/WEB-INF/PageFlow.tld" prefix="PageFlow"%>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic"%>
<%@ taglib uri="/WEB-INF/oval-tag.tld" prefix="oval"%>
<%@ taglib uri="/WEB-INF/custom.tld" prefix="custom"%>
<%@ page import="com.oval.emanager.service.*" %>
<%@ page import="com.oval.foundation.DefaultParams"%>

<%
  //init param
  String privilegeCode = "ALL";
  String strTableName = "";
  String strModuleName = "COM";
  String contextPath = request.getContextPath();
  ExcelEngine.loadStaticFormatCache(DefaultParams.findParam("exceldesc-path"));
%>
<%@ include file="/inc/CommonHeader.inc"%>
<%@ include file="/inc/OvalLocationDefault.inc"%>
<%@ include file="/rpt/ReportURL.inc"%>

<html>
<head>
<title>UploadOrgstdprocessgoals</title>
<PageFlow:CheckPageFlow pageName="p_uporgstdprocessgoals" />
<%@ include file="/inc/CatchError.inc"%>
<%@ include file="/inc/SumDiv.inc"%>
<%
  Vector totalsummary = (Vector)pageContext.getAttribute("totalsummary");
  if(totalsummary == null) totalsummary = new Vector();
  String allflag = (String)pageContext.getAttribute("allflag");
  HashMap UserInfo = (HashMap)session.getAttribute("userinfo");
  if(UserInfo == null) UserInfo = new HashMap();
  String subjectcode = (String)pageContext.getAttribute("subjectcode");
  Integer quarter = (Integer)pageContext.getAttribute("quarter");
  System.out.print("subjectcode="+subjectcode);
%>
<link rel="stylesheet"
	href="<%=contextPath%>/css/<%= strLanguageCode %>/main.css"
	type="text/css">
<script language="JavaScript" src="<%=contextPath%>/css/cn/script.js"></script>
<script language="JavaScript" src="<%=contextPath%>/js/FuncLib.js"></script>
<script language="JavaScript" src="<%=contextPath%>/js/ScriptLib.js"></script>
<script language="JavaScript"
	src="<%=contextPath%>/js/SummaryDivision.js"></script>
<script language="JavaScript">
<%--  put your custom script here   --%>
function page_summary(actionvalue,orderbyname)
{
  var editform = summaryPrepare(cform,actionvalue,orderbyname);
  if(!editform) return;
  editform.action = "UploadOrgstdprocessgoals.jsp?<%= OvalTools.randomURL() %>";
  editform.target = "_self";
  isRunning = true;
  editform.submit();
}


function page_giveup(){
	var flag1 = confirm("<%= message.getMessageDesc("SURE_GIVE_UP")%>");
	if(!flag1){
		return;
	}
	cform.actionname.value = "giveup";
    cform.target = "_self";
    isRunning = true;
    cform.submit();
}	

function page_operate(operand)
{
		    var file = cform.file.value;
			if(file == null)return;
		    cform.encoding="multipart/form-data";
		    cform.code.value = file.substring(file.lastIndexOf("\\")+1,file.indexOf("_"));
		    cform.csvfile.value = file.substring(0,file.lastIndexOf("."))+".csv";
		    cform.actionname.value = "loadfile";
		    cform.target = "_self";
		   	cform.submit();
}



function page_print(){
     var batchno=document.cform.batchno.value;
     <% if (subjectcode.equals("817")){ %>
     var url1 = "<%=reportURL%>/servlet/ExcecuteReport/approve_docprogoalserrormessage1.sox?__format=xlsx&__folder=/ovalreport&employeeid="+document.cform.userid.value;
	 <%}%>
	 <% if (subjectcode.equals("818")){ %>
	 var url1 = "<%=reportURL%>/servlet/ExcecuteReport/approve_docprogoalserrormessage2.sox?__format=xlsx&__folder=/ovalreport&employeeid="+document.cform.userid.value;
	 <%}%>
	 <% if (subjectcode.equals("819")){ %>
	 var url1 = "<%=reportURL%>/servlet/ExcecuteReport/approve_docprogoalserrormessage3.sox?__format=xlsx&__folder=/ovalreport&employeeid="+document.cform.userid.value;
	 <%}%>
	 <% if (subjectcode.equals("823")){ %>
	 var url1 = "<%=reportURL%>/servlet/ExcecuteReport/approve_docprogoalserrormessage4.sox?__format=xlsx&__folder=/ovalreport&employeeid="+document.cform.userid.value;
	 <%}%>
	 url1=url1+"&batchno="+batchno+"&quarter="+document.cform.quarter.value;
	 var strstatus="height=768, width=1024,top=0,left=0,toolbar=no, menubar=no, scrollbars=yes, resizable=yes, location=no, status=no";
    popwindow = window.open(url1, "n1window", strstatus);	

}

function allcheckselect(){
	var allcheck = cform.allcheck.checked;
	var uploadorgids = document.getElementsByName('uploadorgids');
	var length = uploadorgids.length;
	if(allcheck){
		for(var i = 0 ; i < length;i++){
		if(!uploadorgids[i].disabled)
			uploadorgids[i].checked = true;
		}
	}else{
		for(var i = 0 ; i < length;i++){
			uploadorgids[i].checked = false;
		}	
	}
}


function page_check()
{    
    cform.actionname.value = "check";
    cform.target = "_self";
    isRunning = true;
    cform.submit();  
}
function page_submit()
{    
    cform.actionname.value = "submit";
    cform.target = "_self";
    isRunning = true;
    cform.submit();  
}

function page_back(){

	self.location.href ="<%=contextPath%>/zylprocessgoals/ApprovalZylProcessGoalsDetail.jsp?batchno="+document.cform.batchno.value+"&subjectcode=<%=subjectcode %>&<%= OvalTools.randomURL() %>";
}
document.oncontextmenu=function(){
   return false;   
}
</script>
</head>

<body style="overflow: auto;">
<form name="cform" method="post" action="<%=contextPath%>/Dispatcher"><input
	type="hidden" name="pagename" value="p_uporgstdprocessgoals"> 
	<input type="hidden" name="actionname"> 
	
	<input type="hidden" name="code" />
  	<input type="hidden" name="codeinsheet" value = "Y"/>
  	<input type="hidden" name="csvfile" />
  	<input type="hidden" name="subjectcode" value="<%=subjectcode %>">
  	<% if (subjectcode.equals("817")){ %>
	 <input type="hidden" name="uploadiflag" value="modifyorgstdprocessgoals1">
	<%} %>
	<% if (subjectcode.equals("818")){ %>
	 <input type="hidden" name="uploadiflag" value="modifyorgstdprocessgoals2">
	<%} %>
	<% if (subjectcode.equals("819")){ %>
	 <input type="hidden" name="uploadiflag" value="modifyorgstdprocessgoals3">
	<%} %>
	<% if (subjectcode.equals("823")){ %>
	 <input type="hidden" name="uploadiflag" value="modifyorgstdprocessgoals4">
	<%} %>
	<custom:hidden property="quarter"/>
	<custom:hidden property="batchno"/>
	<custom:hidden scope="session" name="userinfo" property="userid"></custom:hidden> 
	
	
	<%--  page location   --%>
<%@ include file="/inc/PageLocation.inc"%>

<table width="100%" cellspacing="0" border="0" cellpadding="0">
	<tr>
		<%--  search criteria  --%>
	</tr>
	<tr>
		<td>
		<table width="100%" border="0" cellspacing="0">
			<tr>
				<td><%= label.getLabelName("L_Path") %><%= label.getLabelName("L_Colon") %><input
					type="file" name="file" size="30"> &nbsp;&nbsp;&nbsp;&nbsp;<a
					onclick="page_operate('upload')"><custom:button type="1"
					label="L_Finish" imgsrc="finish.gif" border="0" style="width:60" /></a>

				</td>			
			</tr>
		</table>
		</td>
	</tr>
	<tr>
		<td>
		<div style="overflow:auto;height:350" id="scrollGDiv">
		<table width="2500" border="1" cellpadding="0"
			bordercolorlight="#999999" bordercolordark="#FFFFFF" cellspacing="0"
			align="center">
			<tr class="deepblue-left">
              <td class="title_center"   width="2%" rowspan="2"><%= label.getLabelName("L_SlipCode") %> </td>
              <!-- 
              <td class="title_center"   width="2%" rowspan="2"><%= label.getLabelName("L_Approve") %> </td>
               -->			  
				<td class="title_center"  width="2%" rowspan="2"><%= label.getLabelName("L_Provicetdr") %></td>
				<td class="title_center"  width="2%" rowspan="2"><%= label.getLabelName("L_Department") %></td>
				<td class="title_center"  width="4%" rowspan="2"><%= label.getLabelName("L_RegionOffice") %></td>
				<td class="title_center"  width="4%" rowspan="2"><%= label.getLabelName("L_Type") %></td>
				<td class="title_center"  width="4%" rowspan="2"><%= label.getLabelName("L_YesOrNoBale") %></td>
				<td class="title_center"  width="4%" rowspan="2"><%= label.getLabelName("L_Grade") %></td>
				<td class="title_center"  width="4%" rowspan="2"><%= label.getLabelName("L_Variety") %></td>
				<td class="title_center"  width="5%" rowspan="2"><%= label.getLabelName("L_QuarterlyIndicators") %></td>
				<td class="title_center"  width="5%" rowspan="2"><%= label.getLabelName("L_LockHospitalNumber") %></td>
				<td class="title_center"  width="5%" rowspan="2"><%= label.getLabelName("L_DevelopedHospitalNum") %></td>
				<td class="title_center"  width="5%" rowspan="2"><%= label.getLabelName("L_UndevelopedHospitalNum")%></td>
				<td class="title_center"  width="15%" colspan="3"><%= label.getLabelName("L_Number")%><%=quarter%><%= label.getLabelName("L_Quarter")%></td>
				<td class="title_center"  width="5%" rowspan="2"><%= label.getLabelName("L_Sum") %></td>
				<td class="title_center"  width="5%" rowspan="2"><%= label.getLabelName("L_ModifiedCombined") %></td>
				<td class="title_center"  width="5%" rowspan="2"><%= label.getLabelName("L_ErrorMsg") %></td>
			</tr>
	     <tr class="deepblue-left">
				<%
				  if(quarter.intValue()==1){
				%>
				<td class="title_center">1<%=label.getLabelName("L_Month") %></td>
				<td class="title_center">2<%=label.getLabelName("L_Month") %></td>
				<td class="title_center">3<%=label.getLabelName("L_Month")%></td>
				<%} %>
				<%
				  if(quarter.intValue()==2){
				%>
				<td class="title_center">4<%=label.getLabelName("L_Month") %></td>
				<td class="title_center">5<%=label.getLabelName("L_Month") %></td>
				<td class="title_center">6<%=label.getLabelName("L_Month")%></td>
				<%} %>
				<%
				  if(quarter.intValue()==3){
				%>
				<td class="title_center">7<%=label.getLabelName("L_Month") %></td>
				<td class="title_center">8<%=label.getLabelName("L_Month") %></td>
				<td class="title_center">9<%=label.getLabelName("L_Month")%></td>
				<%} %>
				<%
				  if(quarter.intValue()==4){
				%>
				<td class="title_center">10<%=label.getLabelName("L_Month") %></td>
				<td class="title_center">11<%=label.getLabelName("L_Month") %></td>
				<td class="title_center">12<%=label.getLabelName("L_Month")%></td>
				<%} %>
		 </tr>   
			<%
	int i=0;
	String strClassType="";
	String checkflag = null;
    Integer ApprovalStatus = new Integer(-1); 
%>
			<%--  the old detail lines  --%>
			<span id="olddetail"> 
			<logic:iterate id="onerow" collection="<%= totalsummary %>" indexId="idx" scope="page">
				<%
	if(i%2 == 1)
	  {
	    strClassType = "td-listrom";
	  }else{                    
	    strClassType = "none";
	  }
	  i++;
	  
	  HashMap row = (HashMap)pageContext.getAttribute("onerow");
	if(row.get("errormassage") != null){
		strClassType = "need";
		
	}
	checkflag = (String)row.get("ck_flag");
	ApprovalStatus = (Integer)(row.get("approvalstatus"));
%>
				<tr onMouseOver="this.className='tr-over'" onMouseOut="this.className='<%=JspHelper.filterNull( strClassType )%>'" class="<%=JspHelper.filterNull( strClassType )%>">
					<!--<td class="title_center">   onClick="javascript:page_radiotrue('<oval:write name="onerow" property="temp_uploadorgid" />')"
					 <input type="checkbox" name="uploadorgids" value="<oval:write name="onerow" property="temp_uploadorgid" />" class="normalradio" disabled="true"></td> -->
					<td><custom:write property="zylorgstdgoalsapproveid" name="onerow" nbsp="true" /></td>
					<td><custom:write property="area1name" name="onerow" nbsp="true" /></td>
					<td><custom:write property="deptname" name="onerow" nbsp="true" /></td>
					<td><custom:write property="area2name" name="onerow" nbsp="true" /></td>
					<td><custom:write property="globalpccode" name="onerow" nbsp="true" /></td>
					<td><custom:write property="isbale" name="onerow" nbsp="true" /></td>
					<td><custom:write property="levelname" name="onerow" nbsp="true" /></td>
					<td><custom:write property="productgroupname" name="onerow" nbsp="true" /></td>
					<td><custom:write property="quarteramount" name="onerow" nbsp="true" /></td>
					<td><custom:write property="all1amount" name="onerow" nbsp="true" /></td>
					<td><custom:write property="developed1amount" name="onerow" nbsp="true" /></td>
					<td><custom:write property="udeveloped1amount" name="onerow" nbsp="true" /></td>
					<td><custom:write property="amount1" name="onerow" nbsp="true" /></td>
					<td><custom:write property="amount2" name="onerow" nbsp="true" /></td>
					<td><custom:write property="amount3" name="onerow" nbsp="true" /></td>
					<td><custom:write property="total1amount" name="onerow" nbsp="true" /></td>
					<td><custom:write property="modify1amount" name="onerow" nbsp="true" /></td>
					<td><custom:write property="errormassage" name="onerow" nbsp="true" /></td>
				</tr>

			</logic:iterate> </span>
			<tr>
				<td colspan="48" align="left"><%= label.getLabelName("L_TotalData") + label.getLabelName("L_Colon") %><custom:write
					property="count" name="count" nbsp="true" /></td>
			</tr>

			<%@ include file="/inc/SummaryActionUP_DH.inc" %>
		</table>
		</div>
		<table width="100%" cellspacing="0" cellpadding="0">
			<tr>
				<td class="summary_top"></td></tr>
            <tr>
              <td class="td_center">
              	<%if (totalsummary.size() > 0){
              	  if(("N").equals(allflag)){%>
				  <a onclick="page_check();"><custom:button type="1" label="L_CheckContent" imgsrc="new.gif" border="0" style="width:60"/></a>
				  <%}else if(("Y").equals(allflag)){ %>
				  <a onclick="page_submit();"><custom:button type="1" label="L_Submit" imgsrc="new.gif" border="0" style="width:60"/></a>
				  <a onclick="javascript:page_print();"><custom:button type="1" label="L_Execcd" imgsrc="new.gif" border="0" style="width:60"/></a>				           
                  <a onclick="javascript:page_giveup();"><custom:button type="1" label="L_GiveUp" imgsrc="new.gif" border="0" style="width:60"/></a> 
    	        <%}}%> 
    	         <a onclick="page_back();"><custom:button type="1" label="L_Back" imgsrc="back.gif" border="0" style="width:60"/></a>
              </td>
            </tr>
          </table>
        </td>
      </tr>
    </table>
</form>
<script>
  document.getElementById("scrollGDiv").style.width=(screen.availWidth - 30);
</script>
</body>
</html>